import { IntervalTimeUnit, UnitAttrStruct } from "../../types/L_Type";
import UnitX from "../../entity/UnitX";
import EventX from "./EventX";

/**是否使用简化初始化需要的参数 */
export type DEFING_CRACK_STARIKE_EVENT_DTL={startCallback?:Function,runCallback:Function,endCallback?:Function,targetux:UnitX,incExtraAttr?:UnitAttrStruct} 



/** 崩解防御事件相关事件 */
export default class DefingCrackStarikeEvent extends EventX {


    dtl:DEFING_CRACK_STARIKE_EVENT_DTL


    constructor(
        intervalUnit: IntervalTimeUnit,
        intervalVal: number,
        execLastedNums: number,
        dtl:DEFING_CRACK_STARIKE_EVENT_DTL
    ) {
        super('DEFING_CRACK_STARIKE',intervalUnit,intervalVal,execLastedNums)
        this.dtl=dtl

    } 


  public start(): void {
     if(this.dtl.incExtraAttr!=undefined){
        this.dtl.targetux.incrUnitAttrs(this.dtl.incExtraAttr)
     }
     //this.dtl.targetux.getEventTypeMap(this.eventType).set(this.eventId,this)
     //this.dtl.targetux.eventTypeMapAddx(this.eventType,this)
     this.dtl.startCallback?.()

  }
  public run(): void {
    this.dtl.runCallback()
  }
  public end(): void {
    if(this.dtl.incExtraAttr!=undefined){
        this.dtl.targetux.redcUnitAttrs(this.dtl.incExtraAttr)
     }
     //this.dtl.targetux.getEventTypeMap(this.eventType)?.delete(this.eventId)
    // this.dtl.targetux.eventTypeMapRemovex(this.eventType,this)
    this.dtl.endCallback?.()

  }
 
 
 
 
 

  
}  